/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-11-27     Administrator       the first version
 */
#ifndef APPLICATIONS_PERIPHERAL_DRIVE_MOTION_MOTIONMANAGE_H_
#define APPLICATIONS_PERIPHERAL_DRIVE_MOTION_MOTIONMANAGE_H_



#include <rtdef.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MOTOR_TOTAL_NUM 40
#define MOTOR_TIME_OUT 30000
typedef struct
{
    char name[10];
    rt_uint8_t motor_num;
    rt_uint8_t board_addr;
    rt_uint8_t dirver_num;
    bool liquied_det;
}MOTOR_MANAGER;

const MOTOR_MANAGER motor_info[MOTOR_TOTAL_NUM+1] = {
//M0 is a demo.
{"XXX",0,0,0,false},
//  name      motor_num board_num  dirver_num   liquied_det
{"M_ARMS_X",    1,        1       ,   1     ,    false  },
{"M_ARMS_Y",    2,        1       ,   2     ,    false  },
{"M_ARMS_Z",    3,        1       ,   3     ,    false  },
{"M_ARMS_Q",    4,        1       ,   4     ,    false  },
{"M_ARMS_W",    5,        1       ,   5     ,    false  },
{"M_ARMS_E",    6,        1       ,   6     ,    false  },
{"M_ARMS_R",    7,        2       ,   1     ,    false  },
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
{"XXX",0,0,0,false},
};




class MotionManage
{
private:
    rt_uint32_t CalibratInfo[20];
public:
    MotionManage();
    virtual ~MotionManage();
public:
    rt_uint32_t GetPosInfo(rt_uint8_t posNo);
    void DummyMotorInit();

};

bool MyBoardMotor(rt_uint8_t motor_num);
rt_uint8_t MotorDiverNum(rt_uint8_t motor_num);
bool haveLiquiedDetection(rt_uint8_t motor_num);
void DummyMotorInit();



extern MotionManage *DummyMotorPtr[40];
#ifdef __cplusplus
}
#endif


#endif /* APPLICATIONS_PERIPHERAL_DRIVE_MOTION_MOTION_MANAGE_H_ */
